#pragma once
#include "tcp_socket.hpp"
class Tcp_client
{
    public:
    Tcp_client(const std::string& ip,uint16_t port):ip_(ip),port_(port)
    {
        sock_.Socket();
    }
    ~Tcp_client()
    {
        sock_.Close();
    }
    bool Connect()
    {
        return sock_.Connect(ip_,port_);
    }
    bool RecvFrom(std::string *buf)
    {
        return sock_.Recv(buf);
    }
    bool SendTo(const std::string &buf)
    {
        return sock_.Send(buf);
    }

    private:
    TcpSocket sock_;
    std::string ip_;
    std::uint16_t port_;
};